import React from 'react'
import { Button } from 'antd-mobile'
import { connect } from 'react-redux'
import { Redirect } from 'react-router-dom'
import { logout } from '../auth.redux'
import Gun from './gun'

function Dashborad(props) {
    const isLogin = props.isLogin
    return (
        <div>
            { !isLogin ? <Redirect to="/login" /> : <Gun /> }
            <Button onClick={ props.logout }>注销</Button>
        </div>
    )
}


export default connect(state => state.auth, { logout })(Dashborad)